#ifndef _ARCHIVE_H_
#define _ARCHIVE_H_

#include "../File_Extractor/fex/fex.h"

struct ArcEntry {
	char* szName;
	unsigned int nLen;
	unsigned int nCrc;
};

// ArchiveLoad class, added by regret
class ArchiveLoad {
public:
	enum {
		ARC_NONE = -1,
		ARC_ZIP = 0,
		ARC_7Z,
		ARC_NUM
	};

	ArchiveLoad();
	virtual ~ArchiveLoad();

	int check(char* name, int zipOnly = 0);
	int open(const char* archive);
	int close();
	int getList(ArcEntry** list, unsigned* count = 0);
	int loadFile(unsigned char* dest, unsigned len, unsigned entry, unsigned* wrote = 0);
	int loadOneFile(const char* arc, const char* file, void** dest, unsigned* wrote = 0);

private:
	File_Extractor* fex;
	fex_err_t err;
	int currentFile;

	inline bool error(const char* error);
};

extern ArchiveLoad archiveLoad;

#endif
